import request from '@/config/axios'

export interface CompetitionVO {
  id: number
  studentNumber: string
  studentName: string
  majorClass: string
  instructor: string
  competitionName: string
  awardingAuthority: string
  awardDate: Date
  awardsCategory: number
  awardsLevel: string
  isTeam: number
  remark: string
  status: number
  reason: string
}

// 查询竞赛情况列表
export const getCompetitionPage = async (params) => {
  return await request.get({ url: `/data/competition/page`, params })
}

// 查询竞赛情况详情
export const getCompetition = async (id: number) => {
  return await request.get({ url: `/data/competition/get?id=` + id })
}

// 新增竞赛情况
export const createCompetition = async (data: CompetitionVO) => {
  return await request.post({ url: `/data/competition/create`, data })
}

// 修改竞赛情况
export const updateCompetition = async (data: CompetitionVO) => {
  return await request.put({ url: `/data/competition/update`, data })
}

// 修改竞赛情况
export const updateCompetitionStatus = async (data: CompetitionVO) => {
  return await request.put({ url: `/data/competition/updateStatus`, data })
}

// 删除竞赛情况
export const deleteCompetition = async (id: number) => {
  return await request.delete({ url: `/data/competition/delete?id=` + id })
}

// 导出竞赛情况 Excel
export const exportCompetition = async (params) => {
  return await request.download({ url: `/data/competition/export-excel`, params })
}
